/*************
**
** Project:      stopwatch
** File info:    $Id: mainwindow.hpp 24 2012-05-04 10:48:01Z Kuzma.Shapran@gmail.com $
** Author:       Copyright (C) 2011 Kuzma Shapran <Kuzma.Shapran@gmail.com>
** License:      GPLv3
**
**  This file is part of Stopwatch.
**
**  Stopwatch is free software: you can redistribute it and/or modify
**  it under the terms of the GNU General Public License as published by
**  the Free Software Foundation, either version 3 of the License, or
**  (at your option) any later version.
**
**  Stopwatch is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**  GNU General Public License for more details.
**
**  You should have received a copy of the GNU General Public License
**  along with Stopwatch.  If not, see <http://www.gnu.org/licenses/>.
**
*************/

#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP


#include <QtGui/QMainWindow>
#include <QtCore/QTimer>
#include <QtCore/QElapsedTimer>

#include "ui_mainwindow.h"


#ifndef Q_OS_SYMBIAN
class QResizeEvent;
#endif

class MainWindow : public QMainWindow, Ui::MainWindow
{
    Q_OBJECT
public:
    enum ScreenOrientation {
        ScreenOrientationLockPortrait,
        ScreenOrientationLockLandscape,
        ScreenOrientationAuto
    };

    explicit MainWindow(QWidget *parent = NULL);

    void setOrientation(ScreenOrientation orientation);
    void showExpanded();

#ifndef Q_OS_SYMBIAN
    void resizeEvent(QResizeEvent *);
#endif

signals:
    void hasLaps(bool);

public slots:
    void startTimer(bool);
    void clearTimer(void);
    void addLap(void);

#ifdef Q_OS_SYMBIAN
    void workAreaResized(int);
#endif

private slots:
    void updateTimer(void);
    void adjustColumns(void);

private:
    QTimer timer;
    QElapsedTimer lap;
    quint64 elapsed;

    void updateOrientation(bool);
};

#endif // MAINWINDOW_HPP
